#FLAGS += $(INC)
#FLAGS += @$(TOPDIR)/core/config/def.mk

ALL_INC_PATHS   = $(patsubst %,-I%,$(SDK_INC) $(EXTRA_INC))

FLAGS += -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-function
FLAGS += -fdata-sections -ffunction-sections
FLAGS += -Os -DNDEBUG
FLAGS += -mcpu=cortex-r5
FLAGS += -mthumb
FLAGS += -mthumb-interwork
FLAGS += -mlong-calls
FLAGS += -mfloat-abi=soft
FLAGS += -mno-unaligned-access

ifeq (x$(USE_LIBC),xyes)
ifeq (x$(USE_NANO),xyes)
FLAGS += -specs=nano.specs
endif
FLAGS += -specs=nosys.specs
else
FLAGS += -nostartfiles -nodefaultlibs
endif
FLAGS += -specs=$(TOPDIR)/core/config/sdk.specs

CFLAGS += $(ALL_INC_PATHS) $(FLAGS) -std=c99
CXXFLAGS += $(ALL_INC_PATHS) $(FLAGS) -std=c++11
LDFLAGS += $(FLAGS) -Wl,--gc-sections

LINK_SCRIPT = $(TOPDIR)/core/config/app.ld
ifneq (x$(USE_LIBC),xyes)
LINK_SCRIPT = $(TOPDIR)/core/config/app_sdkonly.ld
endif